package com.vrv.netmgr.assets.detail;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.TextView;

import com.vrv.netmgr.R;
import com.vrv.netmgr.vo.DeviceInfo;

/**
 * @Description 注册资产查询策略详细信息
 * @author zxb
 * @date
 * 
 */
public class DetailAssetsQryActivityDemo extends Activity {
    private static final String TAG = DetailAssetsQryActivityDemo.class.getSimpleName();
    private static final boolean DEBUG = true;
	//
	private DeviceInfo info;
	public void onCreate(Bundle savedInstanceState){
		if(DEBUG) Log.v(TAG, "onCreate()");
		
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
		setContentView(R.layout.detail_assetsqry);
		getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.common_title);
		getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
		//
		initViews();
		setTitle();
	}
	//
	public void initViews(){
		if(DEBUG) Log.v(TAG, "initViews()");
		
		//
		TextView className = (TextView) findViewById(R.id.assetsqry_class);
		TextView unitName = (TextView) findViewById(R.id.assetsqry_unit);
		TextView depName = (TextView) findViewById(R.id.assetsqry_dep);
		TextView tel = (TextView) findViewById(R.id.assetsqry_tel);
		TextView userName = (TextView) findViewById(R.id.assetsqry_user);
		TextView devIp = (TextView) findViewById(R.id.assetsqry_ip);
		TextView macAddr = (TextView) findViewById(R.id.assetsqry_mac);
		TextView devName = (TextView) findViewById(R.id.assetsqry_dev);
		TextView hardWare = (TextView) findViewById(R.id.assetsqry_info);
		//
		info = (DeviceInfo) getIntent().getSerializableExtra("info");
		//
		className.setText(info.getClassName());
		unitName.setText(info.getOfficeName());
		depName.setText(info.getDeptName());
		tel.setText(info.getTel());
		userName.setText(info.getUserName());
		devIp.setText(info.getIpaddres());
		macAddr.setText(info.getMacAddress());
		devName.setText(info.getDeviceName());
		hardWare.setText(info.getDeviceDesc());
	}
	public void setTitle() {
		if(DEBUG) Log.v(TAG, "setTitle()");
		
		TextView title = (TextView) findViewById(R.id.title_text);
		title.setText("注册资产查询"+"["+info.getIpaddres()+"]");

		/**
		 * 返回按钮
		 */
		ImageButton backBtn = (ImageButton) findViewById(R.id.backBtn);
		backBtn.setVisibility(View.VISIBLE);
		backBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				onBackPressed();
			}
		});
	}
	@Override
	public void onBackPressed() {
		if(DEBUG) Log.v(TAG, "onBackPressed()");
		
		finish();
		overridePendingTransition(R.anim.push_right_out, R.anim.push_right_in);
		super.onBackPressed();
	}
}
